import Vue from 'vue'
import VueRouter from 'vue-router'
import fa from "element-ui/src/locale/lang/fa";
const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error=> error)
}
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/',
    component: () => import(/* webpackChunkName: "home" */ '../components/common/Home.vue'),
    meta: { title: '自述文件', isLogin: false },
    children: [
      {
        path: 'dashboard',
        component: () => import(/* webpackChunkName: "dashboard" */ '../components/page/Dashboard.vue'),
        meta: { title: '系统首页', isLogin: false }
      },
      {
        path: 'user',
        component: () => import(/* webpackChunkName: "dashboard" */ '../components/page/User.vue'),
        meta: { title: '用户管理', isLogin: false }
      },
      {
        path: 'role',
        component: () => import(/* webpackChunkName: "dashboard" */ '../components/page/Role.vue'),
        meta: { title: '用户管理', isLogin: false }
      },
      {
        path: 'datalog',
        component: () => import(/* webpackChunkName: "dashboard" */ '../components/page/Datalog.vue'),
        meta: { title: '用户管理', isLogin: false }
      },
      {
        path: '404',
        component: () => import(/* webpackChunkName: "404" */ '../components/page/404.vue'),
        meta: { title: '404', isLogin: false }
      },
      {
        path:'fac_info',
        component:() => import(/* webpackChunkName "fac_info "*/ '../components/page/fac_info.vue'),
        meta:{ title:'设备信息',isLogin:false}
      },
      {
        path: 'alarm_record',
        component:() => import('../components/page/alarm_record'),
        meta: { title: '报警记录', isLogin: false}
      },
      {
        path: 'welding1',
        component:() => import('../components/page/Dashboard'),
        meta: { title: '焊接一车间', isLogin: false}
      },
      {
        path: 'welding2',
        component:() => import('../components/page/Dashboard'),
        meta: { title: '焊接二车间', isLogin: false}
      },
      {
        path: 'stamping1',
        component:() => import('../components/page/Dashboard'),
        meta: { title: '冲压一车间', isLogin: false}
      },
      {
        path: 'stamping2',
        component:() => import('../components/page/Dashboard'),
        meta: { title: '冲压二车间', isLogin: false}
      }

    ]
  },
  {
    path: '/login',
    component: () => import(/* webpackChunkName: "login" */ '../components/page/Login.vue'),
    meta: { title: '登录', isLogin: false }
  },
  {
    path: '*',
    redirect: '/404'
  }
]

const router = new VueRouter({
  // mode: 'history',
  // base: process.env.BASE_URL,
  routes
})

export default router
